"""
Views for the Live application that return HTML pages.
"""

from django.shortcuts import render_to_response
from django.contrib.auth.decorators import login_required

from track.models import Vehicle
from live.models  import Tag
from live.models  import VehicleTag

@login_required
def welcome(request, template_name):
  """Welcome page"""
  return render_to_response(
    template_name,
    {'user': request.user})

@login_required
def index(request):
  """Textual index page for the live interface"""
  vehicle_list    = Vehicle.objects.all()
  tag_list        = Tag.objects.all()
  vehicleTag_list = VehicleTag.objects.all()
  
  return render_to_response(
    'live/index.html', {
    'vehicle_list':    vehicle_list,
    'tag_list':        tag_list,
    'vehicleTag_list': vehicleTag_list})

@login_required
def live(request):
  """Dynamic live interface"""
  return render_to_response(
    'live/live.xhtml',
    mimetype="application/xhtml+xml")
